﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

// NotReviewedButNeeded

#pragma once

#include "GcmpCommonDraw.h"

namespace gcmp
{
    enum class CursorType;
    class IUiView;
    class ICurve3d;
    class IControlDefinition;
    class IActionInputEventArgs;
    class IPropertyPanelEventArgs;
    class Vector3d;
    class ISnap;
    class IGraphicsElementShape;
    class IPlane;

    /// \brief 绘制圆心-起点-终点弧的操作状态
    enum class DrawArcCenterEndStatus : int32_t
    {
        DACES_NOT_START = 0,            ///< 初始化中
        DACES_GETTING_CENTER_POINT = 1, ///< 获取圆心点
        DACES_GETTING_START_POINT = 2,  ///< 获取圆弧起始点
        DACES_GETTING_END_POINT = 3     ///< 获取圆弧终止点
    };

    /// \brief 绘制圆心-起点-终点弧的Behavior，方便定制绘制Action的行为。
    class GCMP_COMMON_DRAW_EXPORT IActionDrawArcByCenterEndPtBehavior
    {
    public:
        /// \brief 析构函数
        virtual ~IActionDrawArcByCenterEndPtBehavior() {}


        /// \brief 输入对话框特性相关方法
    public:
        /// \brief 定义Action输入对话框UI
        /// \param title [out] 对话框标题
        /// \param inputItems [out] 对话框配置项UI
        /// \return 定制成功则返回true，否则返回false
        virtual bool DefineInputDialog(std::wstring& title, std::vector<OwnerPtr<IControlDefinition>>& inputItems) = 0;

        /// \brief 对话框UI事件处理
        /// \param pArgs 输入事件参数
        /// \return 定制成功则返回true，否则返回false
        virtual bool OnActionInputEvent(gcmp::IActionInputEventArgs* pArgs) = 0;


        /// \brief 属性面板特性定制方法
    public:
        /// \brief 属性面板UI事件处理
        /// \param pArgs 输入事件参数
        /// \return 定制成功则返回true，否则返回false
        virtual bool OnPropertyPanelEvent(gcmp::IPropertyPanelEventArgs* pArgs) = 0;


        /// \brief 通用操作（Action）状态特性方法
    public:
        /// \brief 定义提示信息
        /// \param status 绘制圆心-起点-终点弧操作状态
        /// \param promptMsg [out] 提示字符串
        /// \return 定制成功则返回true，否则返回false
        virtual bool DefinePromptMsg(std::wstring& promptMsg, const gcmp::DrawArcCenterEndStatus status) = 0;

        /// \brief 定义光标类型
        /// \param status 绘制圆心-起点-终点弧操作状态
        /// \param cursorType [out] 光标类型
        /// \return 定制成功则返回true，否则返回false
        virtual bool DefineCursorType(gcmp::CursorType& cursorType, const gcmp::DrawArcCenterEndStatus status) = 0;

        /// \brief 初始化Action
        /// \param pCurrentView 当前Action运行所属的视图
        /// \return 定制成功则返回true，否则返回false
        virtual bool OnInitAction(IUiView* pCurrentView) = 0;

        /// \brief 响应Action拾取圆心点状态改变
        /// \param pCurrentView 当前Action运行所属的视图
        /// \return 定制成功则返回true，否则返回false
        virtual bool OnEnterGettingCenterPointState(IUiView* pCurrentView) = 0;

        /// \brief 响应Action拾取圆弧起始点状态改变
        /// \param pCurrentView 当前Action运行所属的视图
        /// \return 定制成功则返回true，否则返回false
        virtual bool OnEnterGettingStartPointState(IUiView* pCurrentView) = 0;

        /// \brief 响应Action拾取圆弧终止点状态改变
        /// \param pCurrentView 当前Action运行所属的视图
        /// \return 定制成功则返回true，否则返回false
        virtual bool OnEnterGettingEndPointState(IUiView* pCurrentView) = 0;

        /// \brief 绘制圆心-起点-终点弧操作完成行为定制
        /// \param pCurrentView 当前Action运行所属的视图
        /// \param centerPt 圆心点的模型空间坐标
        /// \param startPt 圆弧起始点的模型空间坐标
        /// \param endPt 圆弧终止点的模型空间坐标
        /// \param centerSnap 圆心点的捕捉信息
        /// \param startSnap 圆弧起始点的捕捉信息
        /// \param endSnap 圆弧终止点的捕捉信息
        /// \return 定制成功则返回true，否则返回false
        virtual bool OnDrawArcFinished(gcmp::IUiView* pCurrentView, const gcmp::Vector3d& centerPt, const gcmp::Vector3d& startPt, const gcmp::Vector3d& endPt,
                                     const gcmp::ISnap* centerSnap, const gcmp::ISnap* startSnap, const gcmp::ISnap* endSnap) = 0; 

        /// \brief 响应Action释放
        /// \return 定制成功则返回true，否则返回false
        virtual bool OnDestroyAction() = 0;

        /// \brief 操作对象添加Offset特性定制
    public:
        /// \brief 获取偏移值
        /// \param offset [out] 偏移值
        /// \return 定制成功则返回true，否则返回false
        virtual bool GetOffsetValue(double& offset) = 0;


        /// \brief 预览显示特性方法
    public:
        /// \brief 半径预显过程，更新预览表达数据
        /// \param pCurrentView 当前Action运行所属的视图
        /// \param centerPoint 圆心点的模型空间坐标
        /// \param mousePoint 本次拾取操作后，拾取点的模型空间坐标
        /// \param centerSnap 圆心点的捕捉信息
        /// \param mousePointSnap 本次拾取操作后，拾取点的捕捉信息
        /// \param opGElementShape [in, out]用来预览的表达数据
        /// \return 定制成功则返回true，否则返回false
        virtual bool GetGElementShapeOnRadiusUpdated(gcmp::IUiView* pCurrentView, const gcmp::Vector3d& centerPoint, const gcmp::Vector3d& mousePoint,
                                                const gcmp::ISnap* centerSnap, const gcmp::ISnap* mousePointSnap, 
                                                OwnerPtr<IGraphicsElementShape>& opGElementShape) = 0;

        /// \brief 圆弧预显过程，更新预览表达数据
        /// \param pCurrentView 当前Action运行所属的视图
        /// \param centerPoint 圆心点的模型空间坐标
        /// \param startPoint 圆弧起始点的模型空间坐标
        /// \param mousePoint 本次拾取操作后，拾取点的模型空间坐标
        /// \param centerSnap 圆心点的捕捉信息
        /// \param startSnap 圆弧起始点的捕捉信息
        /// \param mousePointSnap 本次拾取操作后，拾取点的捕捉信息
        /// \param opGElementShape [in, out]用来预览的表达数据
        /// \return 定制成功则返回true，否则返回false
        virtual bool GetGElementShapeOnArcUpdated(gcmp::IUiView* pCurrentView, const gcmp::Vector3d& centerPoint, const gcmp::Vector3d& startPoint, const gcmp::Vector3d& mousePoint,
                                                const gcmp::ISnap* centerSnap, const gcmp::ISnap* startSnap, const gcmp::ISnap* mousePointSnap, 
                                                OwnerPtr<IGraphicsElementShape>& opGElementShape) = 0;

    };
}
